<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* 定义样式 */
        .resC {
            /* color: brown; */
            color: aqua;
        }

        .resBg {
            background-color: cadetblue;
        }

        .resF {
            font-size: larger;
        }

        tr,
        th,
        td {
            border: 1px solid;
        }

        .bGc {
            background-color: brown;
        }
    </style>
</head>

<body>
    <!-- 渲染 -->
    <div id="app">
        <!-- 对象语法 -->
        <!-- v-bind:用true、false来决定是否响应 -->
        <span v-bind:class="styleObj">奇迹在线</span>
    </div>
    <div id="app-2">
        <table>
            <tr>
                <th>ID</th>
                <th>名字</th>
                <th>是否在线</th>
            </tr>
            <tr v-for="i in list">
                <td>{{i.id}}</td>
                <td>{{i.name}}</td>
                <td :class="{bGc:!i.isOnline}">{{i.isOnline}}</td>
            </tr>
        </table>
    </div>
</body>
<script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>
<script>
    // 渲染列表的数据条件
    let res = {
        list: [
            {
                id: 1,
                name: '恰恰',
                isOnline: true
            },
            {
                id: 2,
                name: '奇奇',
                isOnline: true
            },
            {
                id: 3,
                name: '团团',
                isOnline: false
            },
            {
                id: 4,
                name: '阔阔',
                isOnline: true
            }
        ]
    }
    // 控制样式开关
    let result = {
        styleObj: {
            resC: true,// 控制字体颜色
            resBg: true,// 控制背景颜色
            resF: true// 控制字体大小
        }
    }
    // 实例化，绑定
    let app = new Vue({
        el: '#app',
        data: result,// 绑定
    })

    let app2 = new Vue({
        el: '#app-2',
        data: res
    })
</script>

</html>